﻿using DynamicViewFormLibrary.Utils;
using Spire.Doc;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DynamicViewFormLibrary
{
    public class SpireDocManager
    {
        public static void WordToRTF(string loadFile, string saveFile)
        {
            Document doc = new Document();
            doc.LoadFromFile(loadFile);
            doc.SaveToFile(saveFile, FileFormat.Rtf);
        }

        internal static string WordToRTF(string filePath)
        {
            string rtfPath = FilePathUtil.RTFFilePath();
            Document doc = new Document();

            doc.LoadFromFile(filePath);
            doc.SaveToFile(rtfPath, FileFormat.Rtf);

            FilePathUtil.DeleteFile(filePath);

            return rtfPath;
        }

    }
}
